package model.type;

import java.util.HashMap;

import db.ContactTypeDAO;

public class ContactType {
	public static final int MAIL = 1, PHONE = 2; 	
	
	private static HashMap<Integer, ContactType> map 
	= new HashMap<Integer, ContactType>();
	
	private int id;
	private String type;	

	// LOAD EVERYTHING INTO HASHMAP FOR QUICK REFERENCE IN THE FUTURE
	static{
		for(ContactType t: ContactTypeDAO.getAll()){
			map.put(t.getId(), t);
		}		
	}
	
	public static ContactType getContactType(int id){
		return map.get(id);
	}
	
	public ContactType(int id, String type) {
		this.id = id;
		this.type = type;
	}
	
	public int getId() {
		return id;
	}

	public String getType() {
		return type;
	}			
}
